package com.xingongchang.baolebei.photo;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import com.external.activeandroid.annotation.Column;
import com.external.activeandroid.annotation.Table;
import com.insthub.BeeFramework.model.BaseModel;
import com.xingongchang.baolebei.protocol.PHOTO;
@Table(name = "Case_name")
public class Case_name extends BaseModel{
	@Column(name = "small")
	public int goods_id;
	public String goods_name;
	public String short_name;
	public String goods_thumb;
	public String goods_img;
	public String shop_price;
	public String promote_price;
	
	public static Case_name fromJson(JSONObject jsonObject) throws JSONException {
		if (null == jsonObject) {
			return null;
		}

		Case_name localItem = new Case_name();

		JSONArray subItemArray;
		localItem.goods_id = jsonObject.optInt("goods_id");
		localItem.goods_name = jsonObject.optString("goods_name");
		localItem.short_name = jsonObject.optString("short_name");
		localItem.goods_thumb = jsonObject.optString("goods_thumb");
		localItem.goods_img = jsonObject.optString("goods_img");
		localItem.shop_price = jsonObject.optString("shop_price");
		localItem.promote_price = jsonObject.optString("promote_price");
		return localItem;
	}

	public JSONObject toJson() throws JSONException {
		JSONObject localItemObject = new JSONObject();
		JSONArray itemJSONArray = new JSONArray();
		localItemObject.put("goods_id", goods_id);
		localItemObject.put("goods_name", goods_name);
		localItemObject.put("short_name", short_name);
		localItemObject.put("goods_thumb", goods_thumb);
		localItemObject.put("goods_img", goods_img);
		localItemObject.put("shop_price", shop_price);
		localItemObject.put("promote_price", promote_price);
		return localItemObject;
	}
}
